package com.lagou.task15;

import java.util.List;

public class Array {


    public static String toString(int[] arr) {
        if (arr == null) {
            return "null";
        }
        if( arr.length -1 == 0){
            return "[]";


        }
        StringBuilder a = new StringBuilder();
        a.append("[");
        for (int i = 0;i < arr.length;i++){

            if(i == arr.length-1){
                a.append(arr[i]);
            }else {
                a.append(arr[i]).append(",");
            }


        }

        return a.append("]").toString();

    }



}
